import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/table';
import { vipcardList } from '@apps/ant-bus/src/views/business/goods/vipcard/data/api';
import { airportList } from '@apps/ant-bus/src/views/business/airport/data/api';
import { RenderType } from '@pkg/setting';

export const columns: BasicColumn[] = [
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 150,
  },
  {
    title: '会员姓名',
    dataIndex: 'userName',
    width: 120,
  },
  {
    title: '会员卡号',
    dataIndex: 'vipCardNo',
    width: 180,
  },
  {
    title: '卡种名称',
    dataIndex: 'goodsName',
    width: 150,
  },
  {
    title: '手机号',
    dataIndex: 'mobile',
    width: 120,
  },
  {
    title: '证件类型',
    dataIndex: 'identityType',
    width: 120,
    dictData: [
      { label: '身份证', value: 1 },
      { label: '护照', value: 2 },
      { label: '回乡证(港澳台居民来往内地通行证)', value: 3 },
      { label: '台胞证', value: 4 },
      { label: '其他', value: 5 },
      { label: '军人证', value: 6 },
      { label: '外国居留身份证', value: 7 },
      { label: '港澳台居民居住证', value: 8 },
    ],
    renderType: RenderType.DICT,
  },
  {
    title: '证件号码',
    dataIndex: 'identityNo',
    width: 180,
  },
  {
    title: '卡状态',
    dataIndex: 'vipCardState',
    width: 120,
    dictData: [
      { label: '待激活', value: 0 },
      { label: '正常', value: 1 },
      { label: '已过期', value: 2 },
      { label: '未开通', value: 3 },
      { label: '未通过', value: 4 },
      { label: '冻结', value: 5 },
      { label: '退卡中', value: 6 },
      { label: '已退卡', value: 7 },
      { label: '已转卡', value: 8 },
      { label: '已转赠', value: 9 },
      { label: '冻结（延时开通）', value: 10 },
    ],
    renderType: RenderType.DICT,
  },
  {
    title: '开卡日期',
    dataIndex: 'buyDate',
    width: 120,
  },
  {
    title: '开卡地',
    dataIndex: 'airportName',
    width: 120,
  },
  {
    title: '销售',
    dataIndex: 'employeeName',
    width: 120,
  },
  {
    title: '支付金额',
    dataIndex: 'payAmount',
    width: 120,
  },
  {
    title: '备注',
    dataIndex: 'remark',
    width: 200,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'userName',
    label: '姓名',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'mobile',
    label: '手机号',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'vipCardNo',
    label: '卡号',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'goodsId',
    label: '卡种',
    component: 'ApiSelect',
    colProps: { span: 4 },
    componentProps: {
      api: vipcardList,
      params: { handlerName: 'busVipCardListHandler' },
      labelField: 'goodsName',
      valueField: 'goodsId',
      immediate: true,
      showSearch: true,
    },
  },
  {
    field: 'airportId',
    label: '开卡地',
    component: 'ApiSelect',
    colProps: { span: 4 },
    componentProps: {
      api: airportList,
      params: { handlerName: 'busAirportRoleListHandler' },
      labelField: 'airportName',
      valueField: 'airportId',
      immediate: true,
      showSearch: true,
    },
  },
  {
    field: 'vipCardState',
    label: '状态',
    component: 'Select',
    colProps: { span: 4 },
    componentProps: {
      options: [
        { label: '待激活', value: 0 },
        { label: '正常', value: 1 },
        { label: '已过期', value: 2 },
        { label: '未开通', value: 3 },
        { label: '未通过', value: 4 },
        { label: '冻结', value: 5 },
        { label: '退卡中', value: 6 },
        { label: '已退卡', value: 7 },
        { label: '已转卡', value: 8 },
        { label: '已转赠', value: 9 },
        { label: '冻结（延时开通）', value: 10 },
      ],
    },
  },
  {
    field: 'startDate',
    label: '开始日期',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'endDate',
    label: '结束日期',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
];
